<?php
namespace app\api\model;

use think\Model;

class Order extends Base{
    protected $name = 'order';
    protected $updateTime = false;

    // 获取器
    public function getAdminIdAttr($val){
        return (new Admin())->getFind(['id' => $val])['data'];
    }

    public function getStatusAttr($val){
        $status = [1  => '待付款', 2 => '已完成', 3 => '已取消', 4 => '已过期'];
        return $status[$val];
    }

    public function getPayTimeAttr($val){
        if(!$val){
            return '-';
        }

        return date('Y-m-d H:i:s', $val);
    }
}